/*
 * 角色
 */
import { getRequest, postRequest } from '@/lib/axios';

export const roleApi = {
  /**
   * @description: 获取权限列表
   */
  queryAuthList: (params) => {
    return getRequest('/search/auth', params); 
  },
  /**
   * @description: 获取角色列表
   */
  queryList: (params) => {
    return getRequest('/auth/list', params);
  },
  /**
   * @description:添加角色
   */
  create: (data) => {
    return postRequest('/auth/add', data);
  },
  /**
   * @description:更新角色
   */
  edit: (data) => {
    return postRequest('/auth/edit', data);
  },
  /**
   * @description: 获取角色详情
   */
   modifyStatus: (data) => {
    return postRequest('/auth/modify', data); 
   },
  /**
   * @description: 删除角色
   */
  deleteRole: (data: { id }) => {
    return postRequest('/auth/del', data);
  },
  /**
   * @description: 批量设置某角色数据范围
   */
  updateDataScope: (data) => {
    return postRequest('/role/dataScope/updateRoleDataScopeList', data);
  },
  /**
   * @description: 获取当前系统所配置的所有数据范围
   */
  getDataScopeList: () => {
    return getRequest('/dataScope/list');
  },
  /**
   * @description: 获取某角色所设置的数据范围
   */
  getDataScopeByRoleId: (roleId) => {
    return getRequest(`/role/dataScope/getRoleDataScopeList/${roleId}`);
  },
  /**
   * @description: 获取角色成员-员工列表
   */
  queryRoleEmployee: (params) => {
    return postRequest('/role/employee/queryEmployee', params);
  },
  /**
   * @description: 从角色成员列表中移除员工
   */
  deleteEmployeeRole: (employeeId, roleId) => {
    return getRequest('/role/employee/removeEmployee?employeeId=' + employeeId + '&roleId=' + roleId);
  },
  /**
   * @description: 从角色成员列表中批量移除员工
   */
  batchRemoveRoleEmployee: (data) => {
    return postRequest('/role/employee/batchRemoveRoleEmployee', data);
  },
  /**
   * @description: 根据角色id获取角色员工列表(无分页)
   */
  getRoleAllEmployee: (roleId) => {
    return getRequest(`/role/employee/getAllEmployeeByRoleId/${roleId}`);
  },
  /**
   * @description: 角色成员列表中批量添加员工
   */
  batchAddRoleEmployee: (data) => {
    return postRequest('/role/employee/batchAddRoleEmployee', data);
  },
};
